class Env {
  /// Base REST endpoint, injected via --dart-define BASE_URL=...
  static const baseUrl = String.fromEnvironment('BASE_URL', defaultValue: '');

  /// Optional API prefix (e.g. /api)
  static const apiPrefix = String.fromEnvironment('API_PREFIX', defaultValue: '');

  /// Merchant ID for this single-tenant build
  static const merchantId = String.fromEnvironment('MERCHANT_ID', defaultValue: '');

  /// Example of other environment-specific configuration (e.g. Sentry DSN)
  static const sentryDsn = String.fromEnvironment('SENTRY_DSN', defaultValue: '');

  /// Convenience getter that concatenates baseUrl and apiPrefix correctly.
  static String get fullBaseUrl {
    if (baseUrl.isEmpty) return '';
    if (apiPrefix.isEmpty) return baseUrl;
    final prefix = apiPrefix.startsWith('/') ? apiPrefix : '/$apiPrefix';
    final trimmedBase = baseUrl.endsWith('/') ? baseUrl.substring(0, baseUrl.length - 1) : baseUrl;
    return '$trimmedBase$prefix';
  }
} 